﻿using System;
using System.Collections.Generic;
using System.Text;
using DotNet.Common.Command;
using ZLCMS.Business.WeixinService;

namespace ZLCMS.Web.ZLOAuth.Code
{
    /// <summary>
    /// GetMemberAccount命令参数
    /// </summary>
    public class GetConfigScriptParameter : CommandParameter
    {
        public bool DebugMode { get; set; }

        public string Url { get; set; }

    }

    /// <summary>
    /// GetMemberAccount命令调用输出
    /// </summary>
    public class GetConfigScriptResult
    {
        public string Script { get; set; }
    }

    /// <summary>
    /// GetMemberAccount命令
    /// </summary>
    public class GetConfigScriptCommand : SessionCommand<GetConfigScriptResult>
    {
        public override ICommandResult<GetConfigScriptResult> Execute(NHibernate.ISession session, ICommandParameter parameter)
        {
            ICommandResult<GetConfigScriptResult> result = new CommandResult<GetConfigScriptResult>();
            GetConfigScriptParameter param = parameter as GetConfigScriptParameter;
            if (param != null)
            {
                //在这里添加命令内容
                result.Result.Script = JSSDKUtil.GetConfigScript(param.DebugMode, param.Url);
            }
            else
            {
                result.ErrorCode = "0001";
            }
            return result;
        }
    }
}
